<--Back

Car Rental Installation and Setup


This project uses Eclipse 3.2 and JDK 1.5.0_06. I have a few additional plugins installed into Eclipse. These are all optional:

Libraries

Required
This project also requires several libraries:
  • JUnit 4.x (included with Eclipse 3.2)
  • Spring, I used Spring 2.0-RC2
  • Commons Logging, which you can get if you download spring-framework-2.0-rc2-with-dependencies.zip instead of spring-framework-2.0-rc2.zip from Spring Downloads
  • AspectJ 1.5.x

Optional
  • Code coverage with Emma, download here.
  • Code coverage with Cobertura, download here.

The Gory Details

Here are the full instructions. Note that if you've already downloaded/installed any of the above, you'll just need to use your directories instead of the examples provided here.

Download Everything

  1. Download Java JDK 1.5.0
  2. Download Eclipse
  3. Download Spring (get the one with dependencies: spring-framework-2.0-rc2-with-dependencies.zip)
  4. Download
  5. Download AspectJ 1.5.x

Install/Unzip Everything

  1. Install the Java JDK 1.5.0 anywhere you want. I used the defaults so it ended up in C:\Program Files\Java\jdk1.5.0_06. Eclipse should find it.
  2. Unzip the Eclipse zip file anywhere. I used C:\Eclipse
  3. Expand the Spring jar anywhere. I used C:\libs, which creates C:\libs\spring-framework-2.0-rc2
  4. Extract the AspectJ zip anywhere you want. I used C:\libs\aspectj
  5. Create a place to store your Eclipse workspace, I used C:\workspaces\CarRentalExample
  6. Extract to your workspace directory (C:\workspaces\CarRentalExample).

Eclipse/Environment Configuration

  1. Start Eclipse (if you have not already done so) and select your workspace (in my case it is C:\AOP\Workspaces\aspectj)
  2. Close the "Welcome" tab

Import the included Eclipse Preferences
  1. File:Import:General:Preferences
  2. Click on next
  3. Enter <yourworkspace>\ToolConfiguration\EclipsePrefs.epf, e.g. for me it would be: C:\workspaces\CarRentalExample\TooConfiguration\EclipsePrefs.epf
  4. Verify that import all is selected
  5. Click Finish

Optional: Checkstyle Configuration
  1. Windows:Preferences
  2. Select Checkstyle
  3. Click on New
  4. Change Type: to External Configuration File
  5. Set Name: to MyCheckstylePrfs (this name is used by the CarRental project)
  6. Click on Browse and find the file CheckstyleConfig.xml. If you've used the same directory structure as I have, it will be in the directory C:\workspaces\CarRentalExample\ToolConfiguration.
  7. Click on OK (to close the new dialog)
  8. Click on OK (to close preferences)

Optional: PMD Configuration
  1. Windows:Preferences
  2. Select PMD
  3. Select Rules Configuration
  4. Click on Clear All
  5. Answer yes
  6. Click on Import rule set...
  7. Click on Browse
  8. Find the file PMDConfig.xml. If you've used the same directory structure as I have, it will be in the directory C:\workspaces\CarRentalExample\ToolConfiguration.
  9. Click on OK (to finish import dialog)
  10. Click on OK (to finish preferences)
  11. Click on Yes (to rebuild all)

Set Classpath Variables
These steps are optional if you've installed Eclipse and the various libs in the same directories as I've used.

  1. Window:Preferences:Java:Build Path:Classpath Variables
  2. Change SPRING_LIB to where you installed Spring. The preferences file sets it to: C:/libs/spring-framework-2.0-rc2/dist/spring.jar
  3. Change the SPRING_LIB_DIR to point to where the included libs for spring reside. The preferences file sets it to: C:/libs/spring-framework-2.0-rc2/lib
  4. Change the ASPECT_J_LIBS to point to the lib directory that's under where you extracted aspectj. The preferences file sets it to: C:/libs/aspectj/lib
  5. Change the JUNIT4_LIB to point to where JUnit 4's jar file resides under eclipse. The preferences file sets it to: C:/eclipse/plugins/org.junit4_4.1.0/junit-4.1.jar
  6. Click on OK when you're done to close Windows:Preferences

Import the three extracted projects into the Eclipse workspace
  1. File:Import:General:Existing Projects into Workspace
  2. Click on next
  3. Enter the directory of your workspace, e.g. mine would be C:\workspaces\CarRentalExample
  4. Wait for a few seconds or press <enter>
  5. You should see three projects: CarRental, LoggingUtils, ToolConfiguration
  6. Click select all
  7. Click finish

Verify Tests
  1. Wait for the projects to build
  2. Right-click on CarRental
  3. Select Run As:JUnit Test
  4. All 100 tests should pass

Optional: Code Coverage

Optional: Run PMD
  1. Right-click on the project
  2. Select PMD:Check Code with PMD
  3. Do this every so often after you've made changes to the code to see what PMD has to say about your changes.

<--Back